package com.example.controller;

import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authz.annotation.RequiresRoles;
import org.apache.shiro.session.Session;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

/**
 * @ClassName AccountController
 * @Description TODO
 * @Author: XMK
 * @Date: 2020/5/20 10:43
 * @Version: 1.0
 */
@Controller
public class AccountController {

//    @RequiresRoles("admin")
    @GetMapping("/account-info")
    public String account(HttpSession session, HttpServletRequest request) {

        System.out.println("httpsession:" + session.getAttribute("tests"));
        Session shirosession = SecurityUtils.getSubject().getSession();

        Object tests1 = request.getSession().getAttribute("tests");
        System.out.println(tests1);

        Object tests = shirosession.getAttribute("tests");
        System.out.println(tests);

        return "account-info";
    }
}
